﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Workflow.Domain;
using WorkflowCore.Interface;
using WorkflowCore.Models;

namespace Workflow.Application.Step
{
    public class EndStep : StepBody
    {
        private readonly WorkflowContext db;

        public EndStep(WorkflowContext db)
        {
            this.db = db;
        }
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            var model = db.instance.FirstOrDefault(x => x.WorkflowId == context.Workflow.Id);
                model.StepName = "";
                model.AuditUserName = "";
                model.CompeleteTime=DateTime.Now;
                model.Remark = "通过";
                db.instance.Update(model);
                db.SaveChanges();
                Console.WriteLine("您的审批已结束");
            return ExecutionResult.Next();
        }
    }
}
